<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/faces/templates/master_nonav.xhtml">
        <ui:define name="header">
            <ui:decorate template="/faces/templates/elements/header_nonav.xhtml"/>
        </ui:define>
        <ui:define name="content">
            <h:form>
                <h:panelGrid columns="3" cellpadding="5">  
                    <p:outputLabel id="lbl_fn" for="txt_fn" value="#{msg.registration_lbl_fn_value}"/>  
                    <p:inputText id="txt_fn" value="#{registrationBean.user.firstname}" required="true" requiredMessage="#{msg.registration_txt_fn_reqMes}"
                                 validatorMessage="#{msg.registration_txt_fn_valMes}">
                        <f:validateRegex pattern="#{msg.registration_txt_fn_valPat}"  />
                    </p:inputText>
                    <p:message for="txt_fn" showDetail="true"/>
                    <p:outputLabel id="lbl_ln" for="txt_ln" value="#{msg.registration_lbl_ln_value}"/> 
                    <p:inputText id="txt_ln" value="#{registrationBean.user.lastname}" required="true" requiredMessage="#{msg.registration_txt_ln_reqMes}"
                                 validatorMessage="#{msg.registration_txt_ln_valMes}">
                        <f:validateRegex pattern="#{msg.registration_txt_ln_valPat}"/>
                    </p:inputText>
                    <p:message for="txt_ln" showDetail="true"/>
                    <p:outputLabel id="lbl_bd" for="cal_bd" value="#{msg.registration_lbl_bd_value}"/>
                    <p:calendar id="cal_bd" value="#{registrationBean.user.birthday}" required="true" requiredMessage="#{msg.registration_cal_bd_reqMes}" 
                                yearRange="#{msg.registration_cal_bd_yearRange}" navigator="true"  pattern="#{msg.registration_cal_bd_pattern}"/>  
                    <p:message for="cal_bd" showDetail="true"/>
                    <p:outputLabel id="lbl_mail" for="txt_mail" value="#{msg.registration_lbl_mail_value}"/>  
                    <p:inputText id="txt_mail" value="#{registrationBean.user.email}" required="true" requiredMessage="#{msg.registration_txt_mail_reqMes}"
                                 binding="#{registrationBean.emailField}" validatorMessage="#{msg.registration_txt_ln_valMes}">
                        <f:validateRegex pattern="#{msg.registration_txt_mail_valPat}"/>
                    </p:inputText>  
                    <p:message for="txt_mail" showDetail="true"/>
                    <p:outputLabel id="lbl_pw1" for="txt_pw1" value="#{msg.registration_lbl_pw1_value}"/> 
                    <p:password id="txt_pw1" value="#{registrationBean.credential.password}" match="txt_pw2" feedback="true" inline="false" 
                                promptLabel=" " weakLabel="#{msg.registration_txt_pw1_weakLbl}" goodLabel="#{msg.registration_txt_pw1_goodLbl}"
                                strongLabel="#{msg.registration_txt_pw1_strongLbl}" required="true" requiredMessage="#{msg.registration_txt_mail_reqMes}" 
                                validatorMessage="#{msg.registration_txt_pw1_valMes}"/>
                    <p:message for="txt_pw1" showDetail="true"/>
                    <p:outputLabel id="lbl_pw2" for="txt_pw2" value="#{msg.registration_lbl_pw2_value}"/>  
                    <p:password id="txt_pw2" value="#{registrationBean.credential.password}" label="Password 2" required="true" requiredMessage="#{msg.registration_txt_pw2_reqMes}"/> 
                    <p:message for="txt_pw2" showDetail="true"/>
                    <p:commandButton value="#{msg.btn_save}" action="#{registrationBean.register()}" ajax="false"/>
                    <p:commandButton value="#{msg.btn_cancel}" action="/faces/index.xhtml?faces-redirect=true" immediate="true" ajax="false"/>
                </h:panelGrid>
            </h:form>
        </ui:define>
    </ui:composition>
</html>